package com.feynman.pattern.singleton.seriable;

import java.io.Serializable;

/**
 * @ClassName SeriableSingleton
 * @Description 序列化单例
 * @Author Feynman
 * @date 2019/4/4 21:27
 * @Version V1.0
 **/
public class SeriableSingleton implements Serializable {
    private static final SeriableSingleton INSTANCE = new SeriableSingleton();
    private  SeriableSingleton(){}
    public static SeriableSingleton getInstance(){
        return INSTANCE;
    }
    //重写readResolve解决序列化破坏单例
    private Object readResolve(){
        return INSTANCE;
    }
}
